#ifndef EMOTION_STATICEMOTIONMANAGER_H
#define EMOTION_STATICEMOTIONMANAGER_H

#include <QObject>
#include <QMap>


namespace Emotion {

class AbstractEmotion;
class StaticEmotion;

class StaticEmotionManager : public QObject
{
    Q_OBJECT
public:
    typedef QList<AbstractEmotion *> EmotionList;
    typedef QMap<QString, AbstractEmotion*> EmotionMap;

private:
    explicit StaticEmotionManager(QObject *parent = 0);
    virtual ~StaticEmotionManager();

private:
    static StaticEmotionManager *m_instance;

private:
    EmotionList m_emotionList;
    EmotionMap m_emotionByCodeMap;
    EmotionMap m_emotionByNameMap;
    EmotionMap m_emotionByFullPathMap;

    QMap<QString, QString> m_emotionFullPathToCodeMap;
    QMap<QString, QString> m_emotionCodeToFullPathMap;

public:
    static StaticEmotionManager *instance(QObject *parent = 0);

private:
    void init();
    StaticEmotion *createEmotion(int index) const;
    QString getCode(int index) const;
    QString getMeaning(int index) const;
    void append(AbstractEmotion *emotion);

public:
    int size() const;
    int count() const;

    StaticEmotion *findByCode(const QString &code) const;
    StaticEmotion *findByName(const QString &name) const;
    StaticEmotion *findByFullPath(const QString &fullPath) const;

    inline const EmotionList &emotionList() const {
        return m_emotionList;
    }

    inline const QMap<QString, QString> &getEmotionCodeToFullPathMap() const {
        return m_emotionCodeToFullPathMap;
    }

    QString getEmotionCodeByFullPath(const QString &fullPath) const;
    QString getEmotionFullPathByCode(const QString &code) const;
};

} // namespace Emotion

#endif // EMOTION_STATICEMOTIONMANAGER_H
